package com.siruier.boss.ui.helper.loadsir

import android.content.Context
import android.view.View
import android.widget.TextView
import com.kingja.loadsir.callback.Callback
import com.siruier.boss.ui.R
import com.siruier.boss.ui.ext.getString

class EmptyCallback(
    private val imageHeight: Int? = null, private val resIds: Int? = null
) : Callback() {
    override fun onCreateView() = R.layout.view_empty

    override fun onViewCreate(context: Context, view: View) {
        imageHeight?.let {
            //view.findViewById<ImageView>(R.id.ivEmpty).layoutParams.height = imageHeight.dp
        }
        resIds?.let {
            view.findViewById<TextView>(R.id.tv_text).text = getString(resIds)
        }
    }
}

class ErrorCallback : Callback() {
    override fun onCreateView() = R.layout.view_error
}

class LoadingCallback : Callback() {
    override fun onCreateView() = R.layout.view_load
    override fun onReloadEvent(context: Context, view: View) = true
    override fun onViewCreate(context: Context, view: View) {
        //Glide.with(context).asGif().load(R.mipmap.loading).into(view.findViewById(R.id.avloa))
    }
}

class NotNetworkCallback : Callback() {
    override fun onCreateView() = R.layout.view_not_network
}